<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<!-- Set render engine for 360 browser -->
	<meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->

	<link href="/public/simpleboot/themes/<?php echo C('SP_ADMIN_STYLE');?>/theme.min.css" rel="stylesheet">
    <link href="/public/simpleboot/css/simplebootadmin.css" rel="stylesheet">
    <link href="/public/js/artDialog/skins/default.css" rel="stylesheet" />
    <link href="/public/simpleboot/font-awesome/4.4.0/css/font-awesome.min.css"  rel="stylesheet" type="text/css">
    <style>
		.length_3{width: 180px;}
		form .input-order{margin-bottom: 0px;padding:3px;width:40px;}
		.table-actions{margin-top: 5px; margin-bottom: 5px;padding:0px;}
		.table-list{margin-bottom: 0px;}
	</style>
	<!--[if IE 7]>
	<link rel="stylesheet" href="/public/simpleboot/font-awesome/4.4.0/css/font-awesome-ie7.min.css">
	<![endif]-->
<script type="text/javascript">
//全局变量
var GV = {
    DIMAUB: "/",
    JS_ROOT: "public/js/",
    TOKEN: ""
};
document.domain = "xinhuiwen.com";
</script>
<!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="/public/js/jquery.js"></script>
    <script src="/public/js/wind.js"></script>
    <script src="/public/js/publish.js"></script>

    <script src="/public/simpleboot/bootstrap/js/bootstrap.min.js"></script>
<?php if(APP_DEBUG): ?><style>
		#think_page_trace_open{
			z-index:9999;
		}
	</style><?php endif; ?>
</head>
<body style="min-width: 800px;">
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="<?php echo U('commentadmin/index');?>">标签管理</a></li>
		</ul>
            <form class="well form-search" method="get" >
                <input type="hidden" name="g" value="admin" />
                    <input type="hidden" name="m" value="Tag" />
                    <input type="hidden" name="a" value="index" />
                    <input type="hidden" name="id" value="<?php echo ($search["id"]); ?>" />
			
			<input  class="btn btn-primary" onclick="add()"value="创建标签" type="button"/>
		</form>
		<form class="js-ajax-form" method="post">
			<table class="table table-hover table-bordered table-list">
				<thead>
					<tr>
						<th width="50">ID</th>
						<th width="100">标签名称</th>
                                                <th width="80">管理操作</th>
					</tr>
				</thead>
				<?php $status=array("1"=>L('AUDITED'),"0"=>L('NOT_AUDITED')); ?>
				<?php if(is_array($list)): foreach($list as $key=>$vo): ?><tr>
					<td><?php echo ($vo["id"]); ?></td>
					<td><?php echo ($vo["tag_name"]); ?></td>
					<td>
                                            <a href="javascript:void(0);" onclick="edit(<?php echo ($vo["id"]); ?>)">修改</a> |
                                            <a href="<?php echo U('Tag/delete',array('id'=>$vo['id']));?>" class="js-ajax-delete">删除</a>
					</td>
				</tr><?php endforeach; endif; ?>
			</table>
			<div class="pagination"><?php echo ($page); ?></div>
		</form>
	</div>
        <script src="/public/js/common.js"></script>
        <script>
	function edit(id){
			var dialog = art.dialog({
			title: '修改', content: '<table><tbody style=""><tr><td><textarea name="data" id="tag_name" style="width: 98%; height: 50px;" placeholder="请填写"></textarea></td></tr></tbody></table>',
			follow: document.getElementById('btn2'),
			ok: function(){
                            var url = '<?php echo U('Tag/edit');?>';
                            $.post(url, {'id': id,'tag_name':$("#tag_name").val()}, function (json)
                            {
                                if(json.state === 'success'){
                                            reloadPage(window);
                                            return false;
                                }
                                alert(json.info)
                                art.dialog.close();
                            });
                            return false;
                        }
                        });
	}
        
        	function add(){
			var dialog = art.dialog({
			title: '创建标签', content: '<table><tbody style=""><tr><td><textarea name="data" id="tag_name" style="width: 98%; height: 50px;" placeholder="请填写"></textarea></td></tr></tbody></table>',
			follow: document.getElementById('btn2'),
			ok: function(){
                            var url = '<?php echo U('Tag/add');?>';
                            if(!$("#tag_name").val()){
                                alert("标签名不能为空");
                                return false;
                            }
                            $.post(url, {'tag_name':$("#tag_name").val()}, function (json)
                            {
                                if(json.state === 'success'){
                                            reloadPage(window);
                                            return false;
                                }
                                alert(json.info)
                                art.dialog.close();
                            });
                            return false;
                        }
                        });
	}
        function add_batch(){
                var urlVal = 'http://126.com';
                art.dialog.open(urlVal, {
                width:'730px',
                height:'530px',
                title:"创建标签",
                });  
        }
</script>
</body>
</html>